<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class IndexController extends HomeController {

	//系统首页
    public function index(){

       //查询幻灯片
       $banner = M("banner")->field("pic,url")->limit(5)->order("sort")->select();
       $this->assign("banner",$banner);
       //查询最新推荐
       $news = M("news")->where(array("is_show"=>array("eq",1)))->limit(4)->field("id,title,cover")->order("id desc")->select();
       $this->assign("news",$news);
       $this->display();
    }
    
    public function detail(){
        $id = I("id",0,'intval');
        $info =  M("news")->find($id);
        $this->assign("info",$info);
        $this->display();
    }

}